<extend name="Base/common"/>
<block name="side">
    <div class="sidebar">
        <ul class="side-nav">
            <include file="menu"/>
        </ul>
    </div>
</block>
<block name="body">

    <div id="main-content">
        <div id="main" class="main" style="min-height: 380px;">
            <div class="row">
                <h1>历史记录</h1>
                <div class="admin">
                    欢迎 {:get_nickname()} 登陆系统
                </div>
                <include file="Public/dashboardbn"/>
            </div>
            <div class="search-form">
                <form id="search" action="{:U('Index/search')}" method="post" >
                    <div class="sleft">
                        <span class="search-title">经销商代码</span>
                        <input id="dealer_name" class="search-input" type="text" placeholder="" value="{:I('dealer_name','')}" name="dealer_name">
                        <span class="search-title">车牌号码</span>
                        <input id="plate_number" class="search-input" type="text" placeholder="" value="{:I('plate_number','')}" name="plate_number">
                        <span class="search-title">审核状态</span>
                        <div class="dropdown1">
                            <select class="form-control" name="status">
                                <option value="" selected = "selected">已审核</option>
                                <option value="0">未审核</option>
                                <option value="1">已通过</option>
                                <option value="2">未通过</option>
                                <option value="3">已删除</option>
                            </select>
                        </div>
                    </div>
                    <input type="hidden" name="controller" value="{$CONTROLLER_NAME}">
                    <input type="hidden" name="action" value="{$ACTION_NAME}">
                    <button id="searchSubmit" class="btn" target-form="ids" type="submit" data-action="index">搜索</button>
                    <a class="btn ajax-post" target-form="ids"  style="float: right;" href="__SELF__">刷新</a>
                    <a href="{:U('Agent/export')}" id="export" class="btn ajax-post" style="float: right;" >导出记录</a>
                    <a href="{:U('Agent/exportImg')}"  class="btn ajax-post" style="float: right;" >导出图片</a>
                </form>
            </div>
            <div class="table-responsive">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <th>NO.</th>
                            <th>查看结算单</th>
                            <th>经销商名称</th>
                            <th>提交时间</th>
                            <th>车牌号码</th>
                            <th>备件号</th>
                            <th>轮胎条数</th>
                            <th>补贴金额</th>
                            <th>审核状态</th>
                            <th>原因</th>
                            <th>审核时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>

                        <volist name="list" id="info" key="key">
                            <tr class="record" data-id="{$key}" data-picture="{:get_file($info['statement'],'path')}">
                                <td data-id="{$info.id}">{$info.no}</td>
                                <td class="jump-img red" style="cursor:pointer;text-decoration:underline;">
                                    <volist name=":get_images($info['images'])" id="img">
                                        <a class="img" data-src="{$img.path}" style="cursor:pointer;text-decoration:underline;margin: 0 3px;">查看</a>
                                    </volist>
                                </td>
                                <td>{:get_nickname($info['user_id'])}</td>
                                <td title="{$info.created_at|date='Y-m-d H:i:s',###}">{$info.created_at|date='Y-m-d',###}</td>
                                <td>{$info.plate_number}</td>
                                <td>{$info.tyre_number}</td>
                                <td>{$info['number']*2}</td>
                                <td>￥{$info.price}</td>
                                <if condition="$info.status eq 0">
                                    <td class="orange">未审核</td>
                                    <elseif condition="$info.status eq 1" />
                                    <td class="green">通过</td>
                                    <elseif condition="$info.status eq 2" />
                                    <td class="red" title="{$info.cause}" style="cursor: pointer;">未通过</td>
                                    <elseif condition="$info.status eq 3" />
                                    <td class="gray">已删除</td>
                                    <else/>
                                    <td>-</td>
                                </if>
                                <td>
                                    <if condition="$info['cause']">
                                        {$info.cause}
                                        <else />
                                        --
                                    </if>
                                </td>
                                <td title="{$info.checked_at|date='Y-m-d H:i:s',###}"><if condition="$info.checked_at gt 0">{$info.checked_at|date='Y-m-d',###}<else /> - </if></td>

                                <td>
                                    <if condition="$info.status eq 2">
                                        <button class="btn" style="background: #d9534f;border: none;" data-action="redirect" data-confirm="确认要删除吗？" data-src="{:U('Agent/api',['id'=>$info['id'],'action'=>'delete','status'=>3])}"> 删除</button>
                                    </if>
                                </td>

                            </tr>
                        </volist>
                    </tbody>
                </table>
            </div>
            <div class="page">
                <div>
                    {$_page}
                </div>
            </div>

        </div>
    </div>
    <include file="Dealer/var"/>
    <include file="Public/btn"/>
</block>